<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@page import="org.jeecgframework.web.util.StaticValue" %>
<%@include file="/context/mytags.jsp" %>
<t:base type="jquery,easyui,tools,DatePicker"></t:base>
<div class="easyui-layout" fit="true">
    <div region="center" style="padding:1px;">
        <t:datagrid name="cbsEquipmentErrorLogList" fitColumns="false" title="备件申请异常表"
                    actionUrl="cbsEquipmentErrorLogController.do?datagrid" idField="id" fit="true" queryMode="group">
            <t:dgCol title="主键" field="id" hidden="true" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="申请单id" field="codeid" queryMode="single" hidden="true" width="120"></t:dgCol>
            <t:dgCol title="申请单号" field="code" queryMode="single" width="120" query="true"  url="cbsEquipmentApplyController.do?goSpareApplyDetail&applyId={codeid}" funname="CbsserviceDetials"></t:dgCol>
            <t:dgCol title="服务单号id" field="serviceid" queryMode="single" hidden="true" width="120"></t:dgCol>
            <t:dgCol title="服务单号" field="serviceCode" queryMode="single" width="105" url="cbsServiceController.do?detail&id={serviceid}&sn={sn}&code={serviceCode}" funname="Cbsservice"></t:dgCol>
            <t:dgCol title="设备序列号" field="sn" queryMode="single" width="100" query="true"></t:dgCol>
            <t:dgCol title="状态" field="isClose" queryMode="single" query="true" width="60"
                     dictionary="<%=StaticValue.service_ERROR_Log_Type %>"></t:dgCol>
            <t:dgCol title="异常原因" field="abnormalCause" queryMode="single" width="140"></t:dgCol>
            <t:dgCol title="处理方法" field="description" queryMode="single" width="160"></t:dgCol>
            <t:dgCol title="创建时间" field="createDate" queryMode="group" width="135" query="true"></t:dgCol>
            <t:dgCol title="处理人" field="updateName" queryMode="single" width="60"></t:dgCol>
            <t:dgCol title="处理人时间" field="updateDate" formatter="yyyy-MM-dd" queryMode="single" width="100"></t:dgCol>
            <t:dgCol title="处理人结果" field="abnormalResult" queryMode="single" width="140"></t:dgCol>
            <t:dgCol title="需要系统修改" dictionary="<%=StaticValue.need_system_revise %>" field="needSystemRevise" query="true" queryMode="single" width="100"></t:dgCol>
            <t:dgCol title="管理员处理方法" field="adminDescription" queryMode="single" width="120"></t:dgCol>
            <t:dgCol title="管理员处理人" field="adminUpdateBy" queryMode="single" width="90"></t:dgCol>
            <t:dgCol title="管理员处理时间" field="adminUpdateDate" formatter="yyyy-MM-dd" queryMode="single" width="100"></t:dgCol>
            <t:dgCol title="管理员处理结果" field="adminAbnormalResult" queryMode="single" width="140"></t:dgCol>
            <t:dgCol title="操作" field="opt" width="60"></t:dgCol>
            <t:dgFunOpt title="处理" funname="update(id)" exp="isClose#eq#1"/>
            <t:dgToolBar title="导出" icon="icon-putout" funname="ExportXls"></t:dgToolBar>
        </t:datagrid>
    </div>
</div>
<script src="webpage/com/zybk/org.jeecgframework.web/cbsEquipmentErrorLogList.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        //给时间控件加上样式
        $("#cbsEquipmentErrorLogListtb").find("input[name='createDate_begin']").attr("class", "Wdate").attr("style", "height:20px;width:90px;").click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd'});
        });
        $("#cbsEquipmentErrorLogListtb").find("input[name='createDate_end']").attr("class", "Wdate").attr("style", "height:20px;width:90px;").click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd'});
        });
        $("#cbsEquipmentErrorLogListtb").find("input[name='updateDate']").attr("class", "Wdate").attr("style", "height:20px;width:90px;").click(function () {
            WdatePicker({dateFmt: 'yyyy-MM-dd'});
        });
    });
    /**
     * 备件申请详情
     * @constructor
     */
    function CbsserviceDetials(filedName, url){
        addOneTab('备件申请详情页', url);
    }
    /**
     * 服务单详情
     * @constructor
     */
    function Cbsservice(filedName, url){
        addOneTab('服务单详情页', url);
    }
    //导出
    function ExportXls() {
        var currPageRows = $("#cbsEquipmentErrorLogList").datagrid("getRows");
        var idsData = [];
        $(currPageRows).each(function (i, rowData) {
            idsData.push(rowData.id);
        });
        if (idsData.length > 0) {
            myDownload("cbsEquipmentApplyController.do?exportXls", "planIds=" + idsData.join(","));
        } else {
            tip("当前页面没有数据可以导出");
        }
    }

    function update(id) {
        $.dialog.confirm("确认处理？", function (r) {
            if (r) {
                $.dialog({
                    content: "url:cbsEquipmentErrorLogController.do?goUpdate&id="+id,
                    lock: true,
                    title: "处理",
                    zIndex: 2100,
                    width: 660,
                    height: 320,
                    parent: windowapi,
                    cache: false,
                    ok: function () {
                        iframe = this.iframe.contentWindow;
                        iframe.$('#formobj').submit();
                        return false;
                    },
                    cancelVal: '关闭',
                    cancel: function () {
                    }
                });
            }
        });
    }
</script>